<extend name="../layout" />

<block name="main_content">
    <div class="row-fluid">
        <div class="span3">
            <div class="widget-box">
                <div class="widget-title"> <span class="icon"><i class="icon-th"></i></span>
                    <h5>{:L('order_detail')}</h5>
                </div>
                <div class="widget-content nopadding">
                    <table class="table table-bordered table-striped with-check">
                        <thead>
                            <tr>
                                <th align="center">{:L('method')}1: {:L('code_find')}</th>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" class="input span12" placeholder="eg:001-1-1" id="find_by_code" />
                                    <div id="find_by_code_result"></div>
                                </td>
                            </tr>
                            <tr>
                                <th align="center">{:L('method')}2: {:L('name_find')}</th>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" class="input span12" id="find_by_name" />
                                </td>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
        <div class="span9">
            <div class="widget-box">
                <div class="widget-title"> <span class="icon"><i class="icon-th"></i></span>
                    <h5>{:L('order_detail')}</h5>
                    <a href="{:U('index')}" class="label label-info">{:L('go_back')}</a>
                    <a href="{:U('index')}" class="label label-info">{:L('submit')}</a>
                </div>
                <div class="widget-content nopadding">
                    <table class="table table-bordered table-striped with-check">
                      <thead>
                        <tr>
                            <th style="width:70px;">{:L('id')}</th>
                            <th>{:L('goods')}</th>
                            <th>{:L('color')}</th>
                            <th>{:L('standard')}</th>
                            <th>{:L('num')}</th>
                            <th>{:L('operation')}</th>
                        </tr>
                      </thead>
                      <tbody id="paper_table">
                          <volist name="list" id="t">
                              <tr rowid="{$t.id}">
                                  <td>{$t.factory_code_all}</td>
                                  <td>{$t.goods_name}</td>
                                  <td>{$t.color_name}</td>
                                  <td>{$t.standard_name}</td>
                                  <td>
                                      <input type="text" name="num_{$t.id}" rowid="{$t.id}" style="width:50px;" class="input_num" value="{$t.num}" />
                                  </td>
                                  <td>
                                      <a href="javascript:paper.del_product('{$t.id}');" class="btn btn-mini btn-info">
                                          <i class="icon icon-trash"></i>
                                          {:L('delete');}
                                      </a>
                                  </td>
                              </tr>
                          </volist>
                      </tbody>
                      <tfoot>
                          <tr>
                              <td colspan="4">
                                  <volist name="thePaper[processes][nextNode]" id="lpn">
                                      <a href="{:U('/JXC/Returns/doWorkflow/node_id/'.$lpn[id].'/mainrow_id/'.$thePaper[id])}" class="btn btn-{$lpn.btn_class}">{$lpn.name}</a> &nbsp;
                                  </volist>
                                  <a href="javascript:history.go(-1);" class="btn btn-info">{:L('save_current_order_and_go_back')}</a>
                              </td>
                              <td colspan="3">
                                  {:L('total')}
                                  <span class="label label-important" id="total_num">0</span>
                              </td>
                          </tr>
                      </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
</block>


<block name="footer_js">
    <load href="__PUBLIC__/Js/jxc.js" />
    <script type="text/javascript">
        $(function(){
            paper.bind_event();
            paper.update_total_num();
            paper.update_total_price();
            $("#find_by_code").keyup(function(e){
                if(e.which == 13 || e.keyCode == 13) {
                    // 提交增加一条数据
                } else {
                    product.search_by_code($.trim(this.value), '{$thePaper.id}', "paper.add_product");
                }
            });
        });
    </script>
</block>